#import <Cocoa/Cocoa.h>

/* An "Asset" is a file-granularity piece of media of some kind: an image, a movie, etc.  The API model presented here allows for every asset to provide a characteristic "preview image" that can be used to represent it in UI: a scaled-down version for an image, a poster frame image for a movie, etc.  CocoaSlides 1.0 only deals specifically with ImageAssets, but the basic characteristics shared by all assets have been split into the "Asset" base class to facilitate possible future extension to handle other kinds of assets such as movie files.
*/

@interface Asset : NSObject
{
    NSURL *url;                     // location of the referenced media file (from which all of the Asset's remaining properties can be obtained)
    NSDate *dateLastUpdated;        // date we last refreshed our cache of the file's metadata
    unsigned long long fileSize;    // size of data pointed to by URL
    NSImage *previewImage;          // preview image (if loaded/created)
    BOOL includedInSlideshow;       // should asset be included in slideshow playback?
}

+ (NSArray *)fileTypes;

- initWithURL:(NSURL *)newURL;

#pragma mark *** Accessors ***

- (NSURL *)url;
- (void)setURL:(NSURL *)newURL;

- (NSString *)filename; // convenience accessor that returns final part of URL

- (NSString *)localizedTypeDescription;

- (NSDate *)dateLastUpdated;
- (void)setDateLastUpdated:(NSDate *)newDate;

- (unsigned long long)fileSize;
- (void)setFileSize:(unsigned long long)newFileSize;

- (NSImage *)previewImage;
- (void)setPreviewImage:(NSImage *)newPreviewImage;

- (BOOL)includedInSlideshow;
- (void)setIncludedInSlideshow:(BOOL)flag;

#pragma mark *** Loading ***

// These are triggered automatically the first time relevant properties are requested, but can be invoked explicitly to force loading earlier.               
- (BOOL)loadMetadata;
- (BOOL)loadPreviewImage;

- (void)requestPreviewImage;

@end
